/**
 * 
 */
package nezumi.gui;

import java.awt.Component;
import java.awt.Graphics2D;
import java.awt.Point;

import nezumi.state.SensorState;
import nezumi.state.State;

/**
 * @author rui
 * 
 */
public class CompassEntity extends ASpriteEntity {

	private static final Point location = new Point(260, 150);

	/**
	 * @param spriteRef
	 * @param state
	 */
	public CompassEntity(String spriteRef, State state, Component enclosingComp) {
		super(spriteRef, state, enclosingComp);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see nezumi.gui.ASpriteEntity#getLocation()
	 */
	@Override
	protected Point getLocation() {
		return location;
	}

	@Override
	public void draw(Graphics2D g) {

		final double compass = this.state.getSensorState().getState().get(
				SensorState.COMPASS)
				* (Math.PI / 180);

		sprite.drawCentered(g, location.x, location.y, compass - Math.PI / 4,
				this.enclosingComp.getBounds());

	}
}
